using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace MicroFractal.iTunesBrowser.Core.Data.ITunesDB.Item
{
    public class DataItem : Header.Header
    {

        #region Constructors

        public DataItem(MemoryStream data)
            : base(data)
        {
            _stringCount = Helper.ITunesHelper.BytesToInt(data, 12, 4);
        }

        #endregion

        #region Properties

        private int _stringCount;

        public int StringCount
        {
            get { return _stringCount; }
            set { _stringCount = value; }
        }

        public string this[StringDataTypeEnum key]
        {
            get
            {
                if (_properties.ContainsKey(key))
                    return _properties[key].Value;
                return string.Empty;
            }
        }

        private Dictionary<StringDataTypeEnum, StringData> _properties;

        public Dictionary<StringDataTypeEnum, StringData> Properties
        {
            get { return _properties; }
            set { _properties = value; }
        }

        #endregion
    }
}
